<template>
	<div class="contents">
		<van-nav-bar
		  title="新增地址"
		  left-text="返回"
		  left-arrow
		  @click-left="onClickLeft"
		/>
		<div class="content">
			<van-address-edit
				:area-list="areaList"
				show-postal
				show-delete
				show-set-default
				show-search-result
				:search-result="searchResult"
				@save="onSave"
				@delete="onDelete"
				@change-detail="onChangeDetail"
			/>
		</div>
	</div>
</template>

<script>
import Vue from 'vue'
import { Row, Col, Cell, CellGroup, Button, NavBar, AddressList, AddressEdit } from 'vant'
Vue.use(Row).use(Col).use(Cell).use(CellGroup).use(Button).use(NavBar).use(AddressList).use(AddressEdit)
export default {
  data() {
    return {
      areaList,
      searchResult: []
    }
  },

  methods: {
		onClickLeft () {
			this.$router.go(-1)
		},
    onSave() {
      Toast('save');
    },
    onDelete() {
      Toast('delete');
    },
    onChangeDetail(val) {
      if (val) {
        this.searchResult = [{
          name: '黄龙万科中心',
          address: '杭州市西湖区'
        }];
      } else {
        this.searchResult = [];
      }
    }
  }
}
</script>

<style lang="scss" scoped="scoped">
@import '@/lib/reset.scss';
.sellist:after {
	left: 0!important;
	border-bottom: 1px solid #ccc!important;
}
.loginout {
	padding: 0 .1rem;
	margin-top: .1rem;
	box-sizing: border-box;
	color: #fff;
}
</style>
